#!/bin/bash
## filename: test-host-up-or-down.sh
# if 的条件部分可以使用普通的命令进行测试
# 当命令正确执行（$?=0）返回真，否则（$?<>0）返回假
#myhost=centos1.ls-al.me
myhost=$HOSTNAME
if ping -c1 -w2 $myhost &>/dev/null
then  
  echo "$myhost is UP."
else
  echo "$myhost is DOWN." 
fi

